<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" isELIgnored="false" %>
<%@include file="WEB-INF/head/taglib.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
</head>
<body>
<div class="container">
    <div class="row">
        <div class="col-md-6 col-md-offset-3">
            <form action="/edoc/addEdoc" method="post">
                <div class="form-group">
                    <label for="title">文档名称</label>
                    <input type="text" class="form-control" id="title" name="title" value="">
                    <span id="msg"></span>
                </div>
                <div class="form-group">
                    <label for="summary">文档摘要</label>
                    <textarea class="form-control" id="summary" name="summary" rows="3"></textarea>
                </div>
                <div class="form-group">
                    <label for="userName">上传者</label>
                    <input type="hidden" id="uId" name="uId" value="${is_login.id}">
                    <input type="text" class="form-control" id="userName" name="userName" value="${is_login.username}" readonly>
                </div>
                <div class="form-group">
                    <label for="typeId">书籍类型</label>
                    <select class="form-control" name="typeId" id="typeId">
                        <option value="0">请选择书籍类型</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="createDate">上传时间</label>
                    <input type="date" class="form-control" id="createDate" name="createDate" value="">
                </div>
                <button type="submit" class="btn btn-default">新增</button>
            </form>
        </div>
    </div>
</div>

<script>
    $(function () {
        $.ajax({
            url:"/edoc/getAllType",
            type:"get",
            dataType:"json",
            success:function (result) {
                for (let i in result){
                    $("#typeId").append("<option value='"+result[i].tId+"'>"+result[i].tName+"</option>")
                }
            }
        })
    })


</script>
</body>
</html>